#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<stdlib.h>

int main()
{
    pid_t id=fork();
    if(id==0)
    {
        printf("i am child process\n");
        sleep(5);
        exit(1);
    }
    else 
    {
        int status=0;
        pid_t result=waitpid(id,&status,0);
        if(WIFEXITED(status)>0)
        {
        printf("子进程退出码：%d\n",WEXITSTATUS(status));
        }

    }
    return 0;
}
